package com.zmj.constant;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author zmj
 * @date 2021-09-14 17:35
 */

@AllArgsConstructor
@Getter
public enum DemoEnum {

    ORDER_CREATE(0, "创建"),
    ORDER_OVER(1, "结束");

    private Integer code;
    private String value;

    public static String getValueByCode(Integer code) {
        for (DemoEnum value : DemoEnum.values()) {
            if (value.getCode().equals(code)) {
                return value.getValue();
            }
        }
        return "未知";
    }

    public static void main(String[] args) {
        System.out.println(DemoEnum.getValueByCode(DemoEnum.ORDER_CREATE.code));
    }
}
